/*class Animal{
    int a = 10;
    int b = 20;
}

class Dog extends Animal{

}*/
/*import demo1.test;
public class Test extends test{*/
 /*   public  void func() {
        System.out.println(super.a);
    }*/
   /* public static void main1(String[] args) {
        Test test = new Test();
        test.func();
    }*/


/*
class Shape{
    public void draw(){
        System.out.println("画图形");
    }
}

class Rect  extends  Shape{
    public void draw(){
        System.out.println("画矩形");
    }
}


class Cycle  extends  Shape{
    public void draw(){
        System.out.println("画圆形");
    }
}


public class Test {
    public static void main(String[] args) {
        Shape [] shapes = new Shape[]{
             new Rect(),
             new Cycle()
        };
        for (Shape shape:shapes) {
            shape.draw();
        }
    }
}*/
/*import java.util.Arrays;
//顺序表
class MyArrayList{
     public int [] elem;
     public int usedSize;
     public MyArrayList(){
         elem = new int[10];
     }

     public void add(int data){
         if(isFull()){
             this.elem = Arrays.copyOf(elem,elem.length*2);
         }
         elem[usedSize++]=data;
     }

    public void addIndex(int pos,int data) throws PosOutOfBoundsException {
        if(isFull()){
            this.elem = Arrays.copyOf(elem,elem.length*2);
        }
        if(pos<0||pos>elem.length-1){
            throw new PosOutOfBoundsException(pos+"位置异常！");
        }
        elem[pos] = data;
        usedSize++;
    }
    public int  Search(int data){
        for (int i = 0; i <elem.length; i++) {
            if(elem[i]==data){
                return i ;
            }
        }
        return -1;
    }

    public void remove(int data){
        if(isEmpty()){
            System.out.println("数组已为空");
            return;
        }
        int pos = Search(data);
        if(pos==-1){
            System.out.println("没有你要删的数字");
            return;
        }
        for (int i = pos+1; i <elem.length ; i++) {
            elem[i-1]=elem[i];
        }
        usedSize--;
    }

    public boolean key(int data){
        int pos = Search(data);
        return pos==-1? false:true;
    }

    public int get(int pos) throws PosOutOfBoundsException {
        if(pos<0||pos>elem.length-1){
            throw new PosOutOfBoundsException(pos+"位置异常！");
        }
        return elem[pos];
    }

    public void set(int pos, int data) throws PosOutOfBoundsException {
        if(pos<0||pos>elem.length-1){
            throw new PosOutOfBoundsException(pos+"位置异常！");
        }
         elem[pos]= data;
         usedSize++;
    }


    public boolean isFull(){
         return usedSize==elem.length;
     }
    public boolean isEmpty(){
        return usedSize==0;
    }
    public int size(){
         return usedSize;
    }
    public void display(){
        for (int i = 0; i < usedSize; i++) {
            System.out.print(elem[i]+" ");
        }
    }
}*/

public class Test {
    /*public static void main1(String[] args) throws PosOutOfBoundsException {
        MyArrayList arrayList = new MyArrayList();
        arrayList.add(1);
        arrayList.add(2);
        arrayList.add(39);
        arrayList.add(29);
        arrayList.add(59);
        arrayList.add(49);
        arrayList.set(6,5);
        System.out.println(arrayList.get(6));
        arrayList.remove(9);
        arrayList.display();
    }*/
}




















